package com.ming.transaction.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ming.transaction.common.Result;
import com.ming.transaction.common.annotation.RecordLoggerAnnotation;
import com.ming.transaction.entity.Complain;
import com.ming.transaction.entity.Goods;
import com.ming.transaction.service.IComplainService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 信息反馈表 前端控制器
 * </p>
 *
 * @author 陈仕健
 * @since 2023-05-12
 */
@Api(tags = "信息反馈表")
@RestController
@RequestMapping("/complain")
public class ComplainController {

    @Resource
    private IComplainService complainService;

    /**
     * 提交投诉信息
     * @param complain
     * @return
     */
    @PostMapping
    @ApiOperation("提交投诉信息")
    @RecordLoggerAnnotation(value = "提交投诉信息")
    public Result saveComplain(@RequestBody Complain complain){
        return complainService.saveComplain(complain);
    }

    /**
     * 投诉信息分页查询
     * @param pageNum
     * @param pageSize
     * @return
     */
    @ApiOperation("投诉信息分页查询接口")
    @GetMapping("/page")
    public Result PageSearch(@RequestParam Integer pageNum,
                             @RequestParam Integer pageSize){
        return complainService.pageSeach(pageNum,pageSize);
    }

    /**
     * 批量删除投诉信息
     * @param ids
     * @return
     */
    @ApiOperation("批量删除投诉信息")
    @PostMapping("/del/batch")
    public Result delsComplains(@RequestBody List<Integer> ids){
        return Result.success("删除成功!",complainService.removeByIds(ids));
    }
}

